package com.system.connect.springboot_flowers.entity;

import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.time.LocalDateTime;

@Data
@TableName("`order`")
public class Order {
    
    @TableId(type = IdType.AUTO)
    private Long id;
    
    @TableField("order_no")
    private String orderNo;
    
    @TableField("user_id")
    @NotNull(message = "用户ID不能为空")
    private Long userId;
    
    @TableField("total_amount")
    @NotNull(message = "订单总金额不能为空")
    @Min(value = 0, message = "订单总金额必须大于0")
    private BigDecimal totalAmount;
    
    @TableField("pay_amount")
    @NotNull(message = "实付金额不能为空")
    @Min(value = 0, message = "实付金额必须大于0")
    private BigDecimal payAmount;
    
    @TableField("freight_amount")
    @NotNull(message = "运费不能为空")
    private BigDecimal freightAmount;
    
    @TableField("pay_type")
    @NotNull(message = "支付方式不能为空")
    private Integer payType;
    
    @TableField("status")
    @NotNull(message = "订单状态不能为空")
    private Integer status;
    
    @TableField("delivery_type")
    private String deliveryType;
    
    @TableField("delivery_time")
    private String deliveryTime;
    
    @TableField("address_id")
    @NotNull(message = "收货地址ID不能为空")
    private Long addressId;
    
    @TableField("receiver_name")
    @NotNull(message = "收货人姓名不能为空")
    private String receiverName;
    
    @TableField("receiver_phone")
    @NotNull(message = "收货人电话不能为空")
    private String receiverPhone;
    
    @TableField("receiver_province")
    private String receiverProvince;
    
    @TableField("receiver_city")
    private String receiverCity;
    
    @TableField("receiver_district")
    private String receiverDistrict;
    
    @TableField("receiver_address")
    private String receiverAddress;
    
    @TableField("note")
    private String note;
    
    @TableField("invoice_type")
    private String invoiceType;
    
    @TableField(value = "created_time", fill = FieldFill.INSERT)
    private LocalDateTime createdTime;
    
    @TableField(value = "updated_time", fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updatedTime;
    
    @TableLogic
    @TableField("is_deleted")
    private Boolean isDeleted;
}